// axios.post('',{

// })
//获取用户id 正则表达式
let oSearch = document.getElementsByClassName("searchbtn")[0]
let oInput = document.getElementsByClassName("input")
//搜索框将请求传到搜索页面
oSearch.onclick = function() {
    console.log(oInput.value)
    //跳转链接
    location.href="http://www.baidu.com" 
    //传参
    //window.localStorage.setItem()
}
//添加命令功能
//1.用户传入命令，后端将请求传入前端，接收命令后开始实现功能
//2.后端直接把表格传到页面
//功能
let oTbody = document.querySelector("tbody")
let oGetbtn = document.getElementsByClassName("getbtn")[0]
oGetbtn.onclick = function() {
    //后端传入的数据存入一个数组中  用for循环
    /*let trs = oTbody.children
    let tr1 = trs[0].cloneNode(true)
    oTbody.insertBefore(tr1,trs[0])*/
    axios.post('http://fnree5.natappfree.cc/AssetManagement_war_exploded/ViewsUsersServlet')
    .then(function(response){
        console.log(response);
        let arr1 = response.data
        console.log(arr1[0])

    })
    .catch(function(error){
        console.log(error);
    });
}
//同意功能
let oAgreebtn = document.getElementsByClassName("agreebtn")
let oNone = document.getElementsByClassName("none")
for (let i = 0; i < 1; i++) {
    
    oAgreebtn[i].onclick = function() {
        //发出请求传给后端命令，后端传给用户
        //命令成功时结果  需要考虑后端命令是否已经执行完
        //传参：用户名 书名
        
        //书籍数量 判断书籍数量是否足够
        alert('已同意')
        oNone[i].style.display = "none"
    }
    
}
//驳回功能
let oReturnbtn = document.getElementsByClassName("returnbtn")
for (let j = 0; j < 1; j++) {
    oReturnbtn[j].onclick = function() {
        //传命令  确定后端完成命令 返回 弹出

        alert('已驳回')
        oNone[j].style.display = "none"
    }
    
}
//上架
let ul = document.getElementsByClassName("ku_kinds")[0]

let oTopbtn = document.getElementsByClassName("topbtn")[0]

let out = document.getElementsByClassName("out")[0]
let header = document.getElementsByClassName("header")[0]
let search = document.getElementsByClassName("search")[0]
let check = document.getElementsByClassName("check")[0]
let ku = document.getElementsByClassName("book_ku")[0]

oTopbtn.onclick = function() {
    out.style.display = "block"
    header.style.filter = "blur(7px)"
    search.style.filter = "blur(7px)"
    check.style.filter = "blur(7px)"
    ku.style.filter = "blur(7px)"
    // let lis = ul.children;
    // let li1 = lis[0].cloneNode(true)
    // ul.insertBefore(li1,lis[0])
    /*li1.children[1].children[0].innerHTML = "加"*/
}
let oSubmitbtn = document.getElementsByClassName("submitbtn")[0]
oSubmitbtn.onclick = function() {
    //查错

    //关窗口
    if(true) {
        out.style.display = "none"
        header.style.filter = "blur(0px)"
        search.style.filter = "blur(0px)"
        check.style.filter = "blur(0px)"
        ku.style.filter = "blur(0px)"
    }
}
let oClosebtn = document.getElementsByClassName("closebtn")[0]
oClosebtn.onclick = function() {
    out.style.display = "none"
    header.style.filter = "blur(0px)"
    search.style.filter = "blur(0px)"
    check.style.filter = "blur(0px)"
    ku.style.filter = "blur(0px)"
}

//下架 将书名传到后端删除
let oBottombtn = document.getElementsByClassName("bottombtn")

let oKind = document.getElementsByClassName("kind")
let oName = document.getElementsByClassName("name")
//接收后端书籍数量
for (let k = 0; k < 1; k++) {
    
    oBottombtn[k].onclick = function() {
        //传命令  确定后端完成命令 返回 弹出
        alert('已下架')
        oKind[k].style.display = "none"
    }
    
}
//书籍数量会持续改变
//axios({

//})
//从数据库中获得书籍各种信息
//数组长度  问题是图片是否可以上去